/** @file SourcePage.qml
@brief Qt-Complex test application for Harmattan Meego 1.2

@authorname \n
@licenseversion \n
@actualversion - @dateupdate

@licensenote
*/

import QtQuick 1.1
import QtWebKit 1.0
import com.meego 1.0
import "QtComplex" as Framework
import "QtComplex/Theme.js" as Theme
import "QtComplex/Geometry.js" as Geometry
import "QtComplex/TestApplication.js" as Test

Page {
    id: webArea
    tools: commonTools

    // activate the back button
    ToolBarLayout { visible: true }

    Item {
        id: flickContainer

        width: parent.width
        height: parent.height - appTopBanner.height
        anchors.top: appTopBanner.bottom

        Flickable {
            id: flickWebView

            clip: true
            anchors.fill: parent
            contentWidth: webView.width;
            contentHeight: webView.height

            Rectangle {
                id: webrect

                width: webArea.width
                height: webArea.height
                border.color: "black"

                WebView {
                    id: webView

                    BusyIndicator {
                        id: indicator1
                        platformStyle: BusyIndicatorStyle { size: "large" }
                        running:  true;
                        anchors.centerIn: parent
                    }

                    preferredWidth: parent.width
                    preferredHeight: parent.height
                    url: Test.sourceUrl

                    onLoadStarted: {
                    }
                    onLoadFinished: {
                        indicator1.running = false;
                        indicator1.opacity = 0;
                    }
                }
            }
        }
    }

    // Top banner.
    Item {
        id: appTopBanner

        // Width should be always all the mainPage size
        width: parent.width;
        // Height is the percentage dedicated to the banner
        height: Math.round(parent.height * Test.appTopBanner)
        anchors.top: parent.top

        Framework.Loader {
            id: topbannerLoader; width: parent.width; height: parent.height
            obj_color: Test.appBackground; theme: "default"; obj: "StaticBanner"
        }
    }
}
